package com.gxyk.adapter;

import java.util.ArrayList;

import com.example.jiemian.R;
import com.gxyk.bean.ShopEntity;
import com.lidroid.xutils.BitmapUtils;

import android.content.Context;
import android.opengl.Visibility;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ShopEntity_adapter extends BaseAdapter {
private  ArrayList<ShopEntity>ShopEntityS;
private Context context;

	public ShopEntity_adapter(Context context,ArrayList<ShopEntity> shopEntityS) {
    this.context=context;
	this.ShopEntityS = shopEntityS;

}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return   Integer.MAX_VALUE;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return /*ShopEntityS.get(position % ShopEntityS.size())*/
				position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if(convertView==null){
			convertView=View.inflate(context, R.layout.shopentity_item, null);
			holder=new ViewHolder();
			holder.image=(ImageView) convertView.findViewById(R.id.shopentity);
			convertView.setTag(holder);
		}else{
			holder=(ViewHolder) convertView.getTag();
		}	
			BitmapUtils bitmapUtils = new BitmapUtils(context);
			bitmapUtils.display(holder.image, ShopEntityS.get(position % ShopEntityS.size()).getImg());			
		
		return convertView;
	}
public  class ViewHolder{
	public   ImageView  image;
}
}
